package org.game.ddd.client.view;

import org.game.ddd.client.listener.MapListener;
import org.game.ddd.common.model.MapModel;

import javax.swing.*;
import java.awt.*;
import java.util.List;

public class MapView extends JFrame {
    private MapModel mapModel;

    private List<CellView> cellViewList;

    public MapView(MapModel mapModel, List<CellView> cellViewList) {
        super("adfdafsd");
        this.mapModel = mapModel;
        this.cellViewList = cellViewList;
        setLayout(null);
        setSize();
        addCellList();
        addWindowListener(new MapListener.MapWindowListener());
        setBackground(new Color(0, 0, 0));
    }

    private void setSize() {
        setSize(new Dimension(mapModel.getWidth(), mapModel.getHeight()));
    }

    private void addCellList() {
        for (CellView cellView : cellViewList) {
            add(cellView);
        }
    }
}
